<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../Ajs/vue.min.js"></script>
    <style>
        .redC{
            background-color:red;
        }
        .blueC{
            background-color:blue;
        }
        .pinkC{
            background-color:pink;
        }
        .active1{
            color:#eee;
        }


    </style>
</head>
<body>
    <div id="box">
        <ul>
            <li @click="fn(index,$event)" :class="num == index?active1:''" v-for="(item,index) in shuiguo" :key="index" :style="ulLiStyle">{{item}}</li>
        </ul>
        <ol style="position: relative">
            <li :class="item" :style=[olLiStyle,num==index?displayB:""] :key="index" v-for="(item,index) in color"></li>
        </ol>
    </div>
    <script>
        var vm = new Vue({
            el:"#box",
            data:{
                num:0,
                shuiguo:["apple","orange","banana"],
                color:['redC',"blueC","pinkC"],
                active1:"active1",
                active2:"disblock",
                displayB:{
                    display:'block'
                },
                ulLiStyle:{
                    display:"inline-block",
                    margin:'0 10px'
                },
                olLiStyle:{
                    width:'300px',
                    height:'100px',
                    position:'absolute',
                    display: 'none'
                }
            },
            methods:{
                fn(index,event){
                    this.num = index;
                    console.log(event);
                }
            }
        })
    </script>
</body>
</html>
